home *** CD-ROM | disk | FTP | other *** search
/ ADA Programming Guide / ADA Programming Guide.iso / ada_gnu / adainc / a-stwiun.ads < prev    next >
Text File  |  1996-01-30  |  9KB  |  232 lines

  1. ------------------------------------------------------------------------------
  2. --                                                                          --
  3. --                         GNAT RUNTIME COMPONENTS                          --
  4. --                                                                          --
  5. --           A D A . S T R I N G S . W I D E _ U N B O U N D E D            --
  6. --                                                                          --
  7. --                                 S p e c                                  --
  8. --                                                                          --
  9. --                            $Revision: 1.4 $                              --
  10. --                                                                          --
  11. --           Copyright (c) 1992,1993,1994 NYU, All Rights Reserved          --
  12. --                                                                          --
  13. -- GNAT is free software;  you can  redistribute it  and/or modify it under --
  14. -- terms of the  GNU General Public License as published  by the Free Soft- --
  15. -- ware  Foundation;  either version 2,  or (at your option) any later ver- --
  16. -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
  17. -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
  18. -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
  19. -- for  more details.  You should have  received  a copy of the GNU General --
  20. -- Public License  distributed with GNAT;  see file COPYING.  If not, write --
  21. -- to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. --
  22. --                                                                          --
  23. ------------------------------------------------------------------------------
  24.  
  25.  
  26. with Ada.Strings.Wide_Maps;
  27.  
  28. package Ada.Strings.Wide_Unbounded is
  29.  
  30.    Blank : constant Wide_Character := ' ';
  31.  
  32.    type Unbounded_Wide_String is private;
  33.  
  34.    Null_Unbounded_Wide_String : constant Unbounded_Wide_String;
  35.  
  36.    type Wide_String_Access is access all Wide_String;
  37.  
  38.    ---------------------------------
  39.    -- Wide_String Length Function --
  40.    ---------------------------------
  41.  
  42.    function Length (Source : in Unbounded_Wide_String) return Natural;
  43.  
  44.    -----------------------------------------------------
  45.    -- Conversion, Catenation, and Selection Functions --
  46.    -----------------------------------------------------
  47.  
  48.    function To_Unbounded_Wide_String (Source : in Wide_String)
  49.       return Unbounded_Wide_String;
  50.  
  51.    function To_Wide_String (Source : in Unbounded_Wide_String)
  52.      return Wide_String;
  53.  
  54.    function "&" (Left, Right : in Unbounded_Wide_String)
  55.       return Unbounded_Wide_String;
  56.  
  57.    function "&" (Left : in Unbounded_Wide_String; Right : Wide_String)
  58.       return Unbounded_Wide_String;
  59.  
  60.    function "&" (Left : in Wide_String; Right : Unbounded_Wide_String)
  61.       return Unbounded_Wide_String;
  62.  
  63.    function "&" (Left : in Unbounded_Wide_String; Right : Wide_Character)
  64.       return Unbounded_Wide_String;
  65.  
  66.    function "&" (Left : in Wide_Character; Right : Unbounded_Wide_String)
  67.       return Unbounded_Wide_String;
  68.  
  69.    function Element (Source : in Unbounded_Wide_String;
  70.                       Index  : in Positive)
  71.       return Wide_Character;
  72.  
  73.    procedure Replace_Element
  74.      (Source : in out Unbounded_Wide_String;
  75.       Index  : in Positive;
  76.       By     : in Wide_Character);
  77.  
  78.    function Slice (Source : in Unbounded_Wide_String;
  79.                    Low    : in Positive;
  80.                    High   : in Natural)
  81.       return Wide_String;
  82.  
  83.    function "="  (Left, Right : in Unbounded_Wide_String) return Boolean;
  84.  
  85.    function "<"  (Left, Right : in Unbounded_Wide_String) return Boolean;
  86.    function "<=" (Left, Right : in Unbounded_Wide_String) return Boolean;
  87.    function ">"  (Left, Right : in Unbounded_Wide_String) return Boolean;
  88.    function ">=" (Left, Right : in Unbounded_Wide_String) return Boolean;
  89.  
  90.    ------------------------
  91.    -- Search Subprograms --
  92.    ------------------------
  93.  
  94.    function Index (Source   : in Unbounded_Wide_String;
  95.                    Pattern  : in Wide_String;
  96.                    Going    : in Direction := Forward;
  97.                    Mapping  : in Wide_Maps.Wide_Character_Mapping
  98.                                 := Wide_Maps.Identity)
  99.       return Natural;
  100.  
  101.    function Index (Source   : in Unbounded_Wide_String;
  102.                    Pattern  : in Wide_String;
  103.                    Going    : in Direction := Forward;
  104.                    Mapping  : in Wide_Maps.Wide_Character_Mapping_Function)
  105.       return Natural;
  106.  
  107.    function Index (Source : in Unbounded_Wide_String;
  108.                    Set    : in Wide_Maps.Wide_Character_Set;
  109.                    Test   : in Membership := Inside;
  110.                    Going  : in Direction  := Forward) return Natural;
  111.  
  112.  
  113.    function Index_Non_Blank (Source : in Unbounded_Wide_String;
  114.                              Going  : in Direction := Forward)
  115.       return Natural;
  116.  
  117.    function Count (Source   : in Unbounded_Wide_String;
  118.                    Pattern  : in Wide_String;
  119.                    Mapping  : in Wide_Maps.Wide_Character_Mapping
  120.                                 := Wide_Maps.Identity)
  121.       return Natural;
  122.  
  123.    function Count (Source   : in Unbounded_Wide_String;
  124.                    Pattern  : in Wide_String;
  125.                    Mapping  : in Wide_Maps.Wide_Character_Mapping_Function)
  126.       return Natural;
  127.  
  128.    function Count (Source   : in Unbounded_Wide_String;
  129.                    Set      : in Wide_Maps.Wide_Character_Set)
  130.       return Natural;
  131.  
  132.  
  133.    procedure Find_Token (Source : in Unbounded_Wide_String;
  134.                          Set    : in Wide_Maps.Wide_Character_Set;
  135.                          Test   : in Membership;
  136.                          First  : out Positive;
  137.                          Last   : out Natural);
  138.  
  139.    -----------------------------------------
  140.    -- Wide_String Translation Subprograms --
  141.    -----------------------------------------
  142.  
  143.    function Translate
  144.      (Source : in Unbounded_Wide_String;
  145.       Mapping  : in Wide_Maps.Wide_Character_Mapping)
  146.      return Unbounded_Wide_String;
  147.  
  148.    procedure Translate
  149.      (Source : in out Unbounded_Wide_String;
  150.       Mapping  : in Wide_Maps.Wide_Character_Mapping);
  151.  
  152.    function Translate
  153.      (Source : in Unbounded_Wide_String;
  154.       Mapping  : in Wide_Maps.Wide_Character_Mapping_Function)
  155.      return Unbounded_Wide_String;
  156.  
  157.    procedure Translate
  158.      (Source : in out Unbounded_Wide_String;
  159.       Mapping  : in Wide_Maps.Wide_Character_Mapping_Function);
  160.  
  161.    --------------------------------------------
  162.    -- Wide_String Transformation Subprograms --
  163.    --------------------------------------------
  164.  
  165.    function Replace_Slice
  166.       (Source   : in Unbounded_Wide_String;
  167.        Low      : in Positive;
  168.        High     : in Natural;
  169.        By       : in Wide_String)
  170.       return Unbounded_Wide_String;
  171.  
  172.  
  173.    function Insert (Source   : in Unbounded_Wide_String;
  174.                     Before   : in Positive;
  175.                     New_Item : in Wide_String)
  176.       return Unbounded_Wide_String;
  177.  
  178.  
  179.    function Overwrite (Source    : in Unbounded_Wide_String;
  180.                        Position  : in Positive;
  181.                        New_Item  : in Wide_String)
  182.       return Unbounded_Wide_String;
  183.  
  184.  
  185.    function Delete (Source  : in Unbounded_Wide_String;
  186.                     From    : in Positive;
  187.                     Through : in Natural)
  188.       return Unbounded_Wide_String;
  189.  
  190.    function Trim
  191.       (Source : in Unbounded_Wide_String)
  192.       return Unbounded_Wide_String;
  193.  
  194.    function Trim
  195.       (Source : in Unbounded_Wide_String;
  196.        Left   : in Wide_Maps.Wide_Character_Set;
  197.        Right  : in Wide_Maps.Wide_Character_Set)
  198.       return Unbounded_Wide_String;
  199.  
  200.    function Head (Source : in Unbounded_Wide_String;
  201.                   Count  : in Natural;
  202.                   Pad    : in Wide_Character := Blank)
  203.       return Unbounded_Wide_String;
  204.  
  205.    function Tail (Source : in Unbounded_Wide_String;
  206.                   Count  : in Natural;
  207.                   Pad    : in Wide_Character := Blank)
  208.       return Unbounded_Wide_String;
  209.  
  210.    function "*" (Left  : in Natural;
  211.                  Right : in Wide_Character)
  212.       return Unbounded_Wide_String;
  213.  
  214.    function "*" (Left  : in Natural;
  215.                  Right : in Wide_String)
  216.       return Unbounded_Wide_String;
  217.  
  218.    function "*" (Left  : in Natural;
  219.                  Right : in Unbounded_Wide_String)
  220.       return Unbounded_Wide_String;
  221.  
  222. private
  223.  
  224.    type Unbounded_Wide_String is record
  225.       Reference : Wide_String_Access := new Wide_String'("");
  226.    end record;
  227.  
  228.    Null_Unbounded_Wide_String : constant Unbounded_Wide_String :=
  229.                                       (Reference => new Wide_String'(""));
  230.  
  231. end Ada.Strings.Wide_Unbounded;
  232.